/*
 * This file is part of Sponge, licensed under the MIT License (MIT).
 *
 * Copyright (c) SpongePowered <https://www.spongepowered.org>
 * Copyright (c) contributors
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */
package org.spongepowered.common.applaunch.config.common;

import org.spongepowered.configurate.objectmapping.meta.Comment;
import org.spongepowered.configurate.objectmapping.meta.Setting;
import org.spongepowered.configurate.objectmapping.ConfigSerializable;

@ConfigSerializable
public final class ExploitCategory {

    @Setting("mark-chunks-as-dirty-on-entity-list-modification")
    @Comment("Enables forcing chunks to save when an entity is added\n"
             + "or removed from said chunk. This is a partial fix for\n"
             + "some exploits using vehicles."
             + "See https://github.com/PaperMC/Paper/blob/fd1bd5223a461b6d98280bb8f2d67280a30dd24a/Spigot-Server-Patches/0306-Mark-chunk-dirty-anytime-entities-change-to-guarante.patch\n"
             + "(Only affects SpongeVanilla)")
    public boolean markChunksAsDirtyOnEntityListModification = true;

    @Setting("update-tracked-chunk-on-entity-move")
    @Comment("Enables forcing a chunk-tracking refresh on entity movement.\n"
                  + "This enables a guarantee that the entity is tracked in the \n"
                  + "proper chunk when moving."
                  + "https://github.com/PaperMC/Paper/blob/fd1bd5223a461b6d98280bb8f2d67280a30dd24a/Spigot-Server-Patches/0315-Always-process-chunk-registration-after-moving.patch\n"
                  + "(Only affects SpongeVanilla)"
    )
    public boolean updateTrackedChunkOnEntityMove = true;

    @Setting("load-chunk-on-entity-position-set")
    @Comment("Enables focing a chunk load when an entity position\n"
                  + "is set. Usually due to teleportation, vehicle movement\n"
                  + "etc. can a position lead an entity to no longer exist\n"
                  + "within it's currently marked and tracked chunk. This will\n"
                  + "enable that chunk for the position is loaded. Part of several\n"
                  + "exploits."
                  + "See https://github.com/PaperMC/Paper/blob/fd1bd5223a461b6d98280bb8f2d67280a30dd24a/Spigot-Server-Patches/0335-Ensure-chunks-are-always-loaded-on-hard-position-set.patch\n"
                  + "(Only affects SpongeVanilla)"
    )
    public boolean loadChunkOnEntityPositionSet = true;

    @Setting("sync-player-positions-for-vehicle-movement")
    @Comment("Enables forcing updates to the player's location on vehicle movement.\n"
                  + "This is partially required to update the server's understanding of\n"
                  + "where the player exists, and allows chunk loading issues to be avoided\n"
                  + "with laggy connections and/or hack clients."
                  + "See https://github.com/PaperMC/Paper/blob/fd1bd5223a461b6d98280bb8f2d67280a30dd24a/Spigot-Server-Patches/0378-Sync-Player-Position-to-Vehicles.patch\n"
                  + "(Only affects SpongeVanilla)"
    )
    public boolean syncPlayerPositionsForVehicleMovement = true;

    @Setting("max-book-page-size")
    @Comment("Controls the maximum size of a book page. (Default: 32767)")
    public int maxBookPageSize = 32767;

    @Setting("max-book-size")
    @Comment("Controls the maximum size of a book")
    public int maxBookSize = this.maxBookPageSize * 1000;
}
